home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / AppleEvents.a < prev    next >
Encoding:
Text File  |  1997-08-12  |  14.0 KB  |  424 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        AppleEvents.a
  3. ;
  4. ;    Contains:    AppleEvent Package Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0.1
  8. ;
  9. ;    Copyright:    © 1989-1997 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  19. __APPLEEVENTS__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  25.     include 'MixedMode.a'
  26.     ENDIF
  27.     IF &TYPE('__NOTIFICATION__') = 'UNDEFINED' THEN
  28.     include 'Notification.a'
  29.     ENDIF
  30.     IF &TYPE('__EVENTS__') = 'UNDEFINED' THEN
  31.     include 'Events.a'
  32.     ENDIF
  33. ;    Note:    The functions and types for the building and parsing AppleEvent  
  34. ;            messages has moved to AEDataModel.h
  35. ;
  36.  
  37.     IF &TYPE('__AEDATAMODEL__') = 'UNDEFINED' THEN
  38.     include 'AEDataModel.a'
  39.     ENDIF
  40.  
  41.  
  42.                                                             ; Keywords for Apple event parameters 
  43. keyDirectObject                    EQU        '----'
  44. keyErrorNumber                    EQU        'errn'
  45. keyErrorString                    EQU        'errs'
  46. keyProcessSerialNumber            EQU        'psn '                ; Keywords for special handlers 
  47. keyPreDispatch                    EQU        'phac'                ; preHandler accessor call 
  48. keySelectProc                    EQU        'selh'                ; more selector call 
  49.                                                             ; Keyword for recording 
  50. keyAERecorderCount                EQU        'recr'                ; available only in vers 1.0.1 and greater 
  51.                                                             ; Keyword for version information 
  52. keyAEVersion                    EQU        'vers'                ; available only in vers 1.0.1 and greater 
  53. ;  Event Class 
  54.  
  55. kCoreEventClass                    EQU        'aevt'
  56. ;  Event ID’s 
  57.  
  58. kAEOpenApplication                EQU        'oapp'
  59. kAEOpenDocuments                EQU        'odoc'
  60. kAEPrintDocuments                EQU        'pdoc'
  61. kAEQuitApplication                EQU        'quit'
  62. kAEAnswer                        EQU        'ansr'
  63. kAEApplicationDied                EQU        'obit'
  64. ;  Constants for recording 
  65.  
  66. kAEStartRecording                EQU        'reca'                ; available only in vers 1.0.1 and greater 
  67. kAEStopRecording                EQU        'recc'                ; available only in vers 1.0.1 and greater 
  68. kAENotifyStartRecording            EQU        'rec1'                ; available only in vers 1.0.1 and greater 
  69. kAENotifyStopRecording            EQU        'rec0'                ; available only in vers 1.0.1 and greater 
  70. kAENotifyRecording                EQU        'recr'                ; available only in vers 1.0.1 and greater 
  71.  
  72. ;  parameter to AESend 
  73. ; typedef OptionBits                     AESendOptions
  74.  
  75.  
  76. kAENeverInteract                EQU        $00000010            ; server should not interact with user 
  77. kAECanInteract                    EQU        $00000020            ; server may try to interact with user 
  78. kAEAlwaysInteract                EQU        $00000030            ; server should always interact with user where appropriate 
  79. kAECanSwitchLayer                EQU        $00000040            ; interaction may switch layer 
  80. kAEDontRecord                    EQU        $00001000            ; don't record this event - available only in vers 1.0.1 and greater 
  81. kAEDontExecute                    EQU        $00002000            ; don't send the event for recording - available only in vers 1.0.1 and greater 
  82. kAEProcessNonReplyEvents        EQU        $00008000            ; allow processing of non-reply events while awaiting synchronous AppleEvent reply 
  83. ; typedef SInt32                         AESendMode
  84.  
  85.  
  86. kAENoReply                        EQU        $00000001            ; sender doesn't want a reply to event 
  87. kAEQueueReply                    EQU        $00000002            ; sender wants a reply but won't wait 
  88. kAEWaitReply                    EQU        $00000003            ; sender wants a reply and will wait 
  89. kAEDontReconnect                EQU        $00000080            ; don't reconnect if there is a sessClosedErr from PPCToolbox 
  90. kAEWantReceipt                    EQU        $00000200            ; (nReturnReceipt) sender wants a receipt of message 
  91.  
  92. ;  Constants for timeout durations 
  93.  
  94. kAEDefaultTimeout                EQU        -1                    ; timeout value determined by AEM 
  95. kNoTimeOut                        EQU        -2                    ; wait until reply comes back, however long it takes 
  96.  
  97. ;  priority param of AESend 
  98. ; typedef SInt16                         AESendPriority
  99.  
  100.  
  101. kAENormalPriority                EQU        $00000000            ; post message at the end of the event queue 
  102. kAEHighPriority                    EQU        $00000001            ; post message at the front of the event queue (same as nAttnMsg) 
  103.  
  104. ; typedef SInt8                         AEEventSource
  105.  
  106.  
  107. kAEUnknownSource                EQU        0
  108. kAEDirectCall                    EQU        1
  109. kAESameProcess                    EQU        2
  110. kAELocalProcess                    EQU        3
  111. kAERemoteProcess                EQU        4
  112.  
  113.  
  114.  
  115. ; **************************************************************************
  116. ;  The next couple of calls are basic routines used to create, send,
  117. ;  and process AppleEvents. 
  118. ;*************************************************************************
  119.  
  120. ;
  121. ; pascal OSErr AESend(const AppleEvent *theAppleEvent, AppleEvent *reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks, AEIdleUPP idleProc, AEFilterUPP filterProc)
  122. ;
  123.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  124.         Macro
  125.         _AESend
  126.             move.w              #$0D17,D0
  127.             dc.w                $A816
  128.         EndM
  129.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  130.         IMPORT_CFM_FUNCTION AESend
  131.     ENDIF
  132.  
  133. ;
  134. ; pascal OSErr AEProcessAppleEvent(const EventRecord *theEventRecord)
  135. ;
  136.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  137.         Macro
  138.         _AEProcessAppleEvent
  139.             move.w              #$021B,D0
  140.             dc.w                $A816
  141.         EndM
  142.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  143.         IMPORT_CFM_FUNCTION AEProcessAppleEvent
  144.     ENDIF
  145.  
  146.  
  147. ;  
  148. ; Note: during event processing, an event handler may realize that it is likely
  149. ; to exceed the client's timeout limit. Passing the reply to this
  150. ; routine causes a wait event to be generated that asks the client
  151. ; for more time. 
  152. ;
  153.  
  154. ;
  155. ; pascal OSErr AEResetTimer(const AppleEvent *reply)
  156. ;
  157.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  158.         Macro
  159.         _AEResetTimer
  160.             move.w              #$0219,D0
  161.             dc.w                $A816
  162.         EndM
  163.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  164.         IMPORT_CFM_FUNCTION AEResetTimer
  165.     ENDIF
  166.  
  167.  
  168. ; **************************************************************************
  169. ;  The following three calls are used to allow applications to behave
  170. ;  courteously when a user interaction such as a dialog box is needed. 
  171. ;*************************************************************************
  172.  
  173.  
  174. ; typedef SInt8                         AEInteractAllowed
  175.  
  176.  
  177. kAEInteractWithSelf                EQU        0
  178. kAEInteractWithLocal            EQU        1
  179. kAEInteractWithAll                EQU        2
  180. ;
  181. ; pascal OSErr AEGetInteractionAllowed(AEInteractAllowed *level)
  182. ;
  183.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  184.         Macro
  185.         _AEGetInteractionAllowed
  186.             move.w              #$021D,D0
  187.             dc.w                $A816
  188.         EndM
  189.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  190.         IMPORT_CFM_FUNCTION AEGetInteractionAllowed
  191.     ENDIF
  192.  
  193. ;
  194. ; pascal OSErr AESetInteractionAllowed(AEInteractAllowed level)
  195. ;
  196.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  197.         Macro
  198.         _AESetInteractionAllowed
  199.             move.w              #$011E,D0
  200.             dc.w                $A816
  201.         EndM
  202.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  203.         IMPORT_CFM_FUNCTION AESetInteractionAllowed
  204.     ENDIF
  205.  
  206. ;
  207. ; pascal OSErr AEInteractWithUser(long timeOutInTicks, NMRecPtr nmReqPtr, AEIdleUPP idleProc)
  208. ;
  209.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  210.         Macro
  211.         _AEInteractWithUser
  212.             move.w              #$061C,D0
  213.             dc.w                $A816
  214.         EndM
  215.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  216.         IMPORT_CFM_FUNCTION AEInteractWithUser
  217.     ENDIF
  218.  
  219.  
  220. ; **************************************************************************
  221. ;  These calls are used to set up and modify the event dispatch table.
  222. ;*************************************************************************
  223.  
  224. ;
  225. ; pascal OSErr AEInstallEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP handler, long handlerRefcon, Boolean isSysHandler)
  226. ;
  227.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  228.         Macro
  229.         _AEInstallEventHandler
  230.             move.w              #$091F,D0
  231.             dc.w                $A816
  232.         EndM
  233.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  234.         IMPORT_CFM_FUNCTION AEInstallEventHandler
  235.     ENDIF
  236.  
  237. ;
  238. ; pascal OSErr AERemoveEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP handler, Boolean isSysHandler)
  239. ;
  240.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  241.         Macro
  242.         _AERemoveEventHandler
  243.             move.w              #$0720,D0
  244.             dc.w                $A816
  245.         EndM
  246.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  247.         IMPORT_CFM_FUNCTION AERemoveEventHandler
  248.     ENDIF
  249.  
  250. ;
  251. ; pascal OSErr AEGetEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP *handler, long *handlerRefcon, Boolean isSysHandler)
  252. ;
  253.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  254.         Macro
  255.         _AEGetEventHandler
  256.             move.w              #$0921,D0
  257.             dc.w                $A816
  258.         EndM
  259.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  260.         IMPORT_CFM_FUNCTION AEGetEventHandler
  261.     ENDIF
  262.  
  263.  
  264. ; **************************************************************************
  265. ; The following four calls are available for applications which need more
  266. ; sophisticated control over when and how events are processed. Applications
  267. ; which implement multi-session servers or which implement their own
  268. ; internal event queueing will probably be the major clients of these
  269. ; routines. They can be called from within a handler to prevent the AEM from
  270. ; disposing of the AppleEvent when the handler returns. They can be used to
  271. ; asynchronously process the event (as MacApp does).
  272. ;*************************************************************************
  273.  
  274. ;
  275. ; pascal OSErr AESuspendTheCurrentEvent(const AppleEvent *theAppleEvent)
  276. ;
  277.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  278.         Macro
  279.         _AESuspendTheCurrentEvent
  280.             move.w              #$022B,D0
  281.             dc.w                $A816
  282.         EndM
  283.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  284.         IMPORT_CFM_FUNCTION AESuspendTheCurrentEvent
  285.     ENDIF
  286.  
  287. ;  
  288. ; Note: The following routine tells the AppleEvent manager that processing
  289. ; is either about to resume or has been completed on a previously suspended
  290. ; event. The procPtr passed in as the dispatcher parameter will be called to
  291. ; attempt to redispatch the event. Several constants for the dispatcher
  292. ; parameter allow special behavior. They are:
  293. ;      - kAEUseStandardDispatch means redispatch as if the event was just
  294. ;      received, using the standard AppleEvent dispatch mechanism.
  295. ;      - kAENoDispatch means ignore the parameter.
  296. ;         Use this in the case where the event has been handled and no
  297. ;      redispatch is needed.
  298. ;      - non nil means call the routine which the dispatcher points to.
  299. ;
  300.  
  301. ;  Constants for Refcon in AEResumeTheCurrentEvent with kAEUseStandardDispatch 
  302.  
  303. kAEDoNotIgnoreHandler            EQU        $00000000
  304. kAEIgnoreAppPhacHandler            EQU        $00000001            ; available only in vers 1.0.1 and greater 
  305. kAEIgnoreAppEventHandler        EQU        $00000002            ; available only in vers 1.0.1 and greater 
  306. kAEIgnoreSysPhacHandler            EQU        $00000004            ; available only in vers 1.0.1 and greater 
  307. kAEIgnoreSysEventHandler        EQU        $00000008            ; available only in vers 1.0.1 and greater 
  308. kAEIngoreBuiltInEventHandler    EQU        $00000010            ; available only in vers 1.0.1 and greater 
  309. kAEDontDisposeOnResume            EQU        $80000000            ; available only in vers 1.0.1 and greater 
  310. ;  Constants for AEResumeTheCurrentEvent 
  311.  
  312. kAENoDispatch                    EQU        0                    ; dispatch parameter to AEResumeTheCurrentEvent takes a pointer to a dispatch 
  313. kAEUseStandardDispatch            EQU        $FFFFFFFF            ; table, or one of these two constants 
  314. ;
  315. ; pascal OSErr AEResumeTheCurrentEvent(const AppleEvent *theAppleEvent, const AppleEvent *reply, AEEventHandlerUPP dispatcher, long handlerRefcon)
  316. ;
  317.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  318.         Macro
  319.         _AEResumeTheCurrentEvent
  320.             move.w              #$0818,D0
  321.             dc.w                $A816
  322.         EndM
  323.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  324.         IMPORT_CFM_FUNCTION AEResumeTheCurrentEvent
  325.     ENDIF
  326.  
  327. ;
  328. ; pascal OSErr AEGetTheCurrentEvent(AppleEvent *theAppleEvent)
  329. ;
  330.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  331.         Macro
  332.         _AEGetTheCurrentEvent
  333.             move.w              #$021A,D0
  334.             dc.w                $A816
  335.         EndM
  336.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  337.         IMPORT_CFM_FUNCTION AEGetTheCurrentEvent
  338.     ENDIF
  339.  
  340. ;
  341. ; pascal OSErr AESetTheCurrentEvent(const AppleEvent *theAppleEvent)
  342. ;
  343.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  344.         Macro
  345.         _AESetTheCurrentEvent
  346.             move.w              #$022C,D0
  347.             dc.w                $A816
  348.         EndM
  349.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  350.         IMPORT_CFM_FUNCTION AESetTheCurrentEvent
  351.     ENDIF
  352.  
  353.  
  354. ; **************************************************************************
  355. ;  These calls are used to set up and modify special hooks into the
  356. ;  AppleEvent manager.
  357. ;*************************************************************************
  358.  
  359. ;
  360. ; pascal OSErr AEInstallSpecialHandler(AEKeyword functionClass, UniversalProcPtr handler, Boolean isSysHandler)
  361. ;
  362.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  363.         Macro
  364.         _AEInstallSpecialHandler
  365.             move.w              #$0500,D0
  366.             dc.w                $A816
  367.         EndM
  368.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  369.         IMPORT_CFM_FUNCTION AEInstallSpecialHandler
  370.     ENDIF
  371.  
  372. ;
  373. ; pascal OSErr AERemoveSpecialHandler(AEKeyword functionClass, UniversalProcPtr handler, Boolean isSysHandler)
  374. ;
  375.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  376.         Macro
  377.         _AERemoveSpecialHandler
  378.             move.w              #$0501,D0
  379.             dc.w                $A816
  380.         EndM
  381.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  382.         IMPORT_CFM_FUNCTION AERemoveSpecialHandler
  383.     ENDIF
  384.  
  385. ;
  386. ; pascal OSErr AEGetSpecialHandler(AEKeyword functionClass, UniversalProcPtr *handler, Boolean isSysHandler)
  387. ;
  388.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  389.         Macro
  390.         _AEGetSpecialHandler
  391.             move.w              #$052D,D0
  392.             dc.w                $A816
  393.         EndM
  394.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  395.         IMPORT_CFM_FUNCTION AEGetSpecialHandler
  396.     ENDIF
  397.  
  398.  
  399. ; **************************************************************************
  400. ;  This call was added in version 1.0.1. If called with the keyword
  401. ;  keyAERecorderCount ('recr'), the number of recorders that are
  402. ;  currently active is returned in 'result'
  403. ;  (available only in vers 1.0.1 and greater).
  404. ;*************************************************************************
  405.  
  406. ;
  407. ; pascal OSErr AEManagerInfo(AEKeyword keyWord, long *result)
  408. ;
  409.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  410.         Macro
  411.         _AEManagerInfo
  412.             move.w              #$0441,D0
  413.             dc.w                $A816
  414.         EndM
  415.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  416.         IMPORT_CFM_FUNCTION AEManagerInfo
  417.     ENDIF
  418.  
  419.  
  420.  
  421.     ENDIF ; __APPLEEVENTS__ 
  422.  
  423.